<?php

// this is part of my experiement/example for doing JOINs with entities and Doctrine.

// refer to link at http://hellounderscoreworld.blogspot.com/2012/04/doctrine-joins.html

// uses entities ORM\Testing\Firstnames and ORM\Testing\Lastnames and corresponding sql tables

class Test_namejoins_insert extends CI_Controller {

	public function __construct() {
            parent::__construct(); 

	}
        
        public function index() {

		echo "Hello!</br>";

		$new_lastname = new ORM\Testing\Lastnames;
		$new_lastname -> setLastName ('Wordsworth');
		$this->doctrine->em->persist($new_lastname);
	        $this->doctrine->em->flush();

		echo $new_lastname ->getID();

		$identifier = $new_lastname ->getID();

		$new_firstname = new ORM\Testing\Firstnames;
        	$new_firstname->setFirstname('Harold');
		$new_firstname->setMyLastName($new_lastname);
		//$new_firstname->setMyLastName('1');
		$this->doctrine->em->persist($new_firstname);
	       $this->doctrine->em->flush();




	}
}